home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_lag_boomrotate.cog < prev    next >
Text File  |  1999-11-15  |  9KB  |  385 lines

  1. # Jones 3D Cog Script
  2. #
  3. # lag_BoomRotate.cog
  4. #
  5. # Rotating Boom Script
  6. #
  7. # [DS & revised by HB]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ==============================================================================
  11.  
  12. symbols
  13.  
  14.     message    startup
  15.     message    activated    
  16.     message    arrived
  17.     message    timer    
  18.  
  19.     keyframe    pull=in_turn_crank1.key                    local   
  20.     keyframe    turnbd=in_turn_bd_stand_crank1.key        local   
  21.     keyframe    standbd=in_stand_bd_turn_crank1.key        local
  22.     keyframe    turncrnk=lag_crnk_rsty.key                local
  23.     keyframe    in_reach=in_activate_medium.key            local
  24.     keyframe    in_bothup=0in_armsup_1_1.key            local
  25.  
  26. # Indy saylines...
  27.     sound        crnkplace=inxj108.wav        local        #there.
  28.  
  29. # no item line...    
  30.     sound        nocrnk=lg02j02.wav        local        #if I had the right tool....
  31.  
  32. # wrong item...
  33.     sound    in_itemline0=Inxj089.wav        local # That didn't work.
  34.     sound    in_itemline1=Inxj090.wav        local # ...something wrong.
  35.     sound    in_itemline2=Inxj092.wav        local # Hmm...didn't quite work.
  36.     sound    in_itemline3=Inxj060.wav        local # I don't think...right answer.
  37.     sound    in_itemline4=Inxj087.wav        local # Whoops.
  38.     sound    in_itemline5=Inxj088.wav        local # Nope.
  39.     sound    in_itemline6=Inxj091.wav        local # Of course that didn't work.
  40.  
  41. # wrong spot...
  42.     sound    in_wrongspot0=Inxj219.wav        local # Not lined up right
  43.     sound    in_wrongspot1=Inxj220.wav        local # Need to line up
  44.     sound    in_wrongspot2=Inxj221.wav        local # Need to move over.
  45.     sound    in_wrongspot3=Inxj222.wav        local # Not quite in position.
  46.     sound    in_wrongspot4=Inxj223.wav        local # Need to get in position.
  47.     sound    in_wrongspot5=Inxj224.wav        local # Need to find better spot.
  48.  
  49. # sfx...
  50.     sound        crankmove=shw_crank_turn.wav            local
  51.     sound        placecrnk=sea_launch_wheel_attach.wav    local
  52.  
  53.        thing    player                            local
  54.  
  55.     thing        boom0
  56.     thing        crank0
  57.     thing        crate0
  58.     thing        pully0
  59.     thing        crnkghost    
  60.  
  61.     thing        indyactor
  62.     thing        crankindy
  63.     thing        campos
  64.     thing        lookpos                                    local
  65.  
  66.     thing        walkpos                                    nolink    # offstage spot
  67.     thing        rstycrnk                                local
  68.     thing        crankcam                                local
  69.  
  70.     template    tpl_crank=rstcrnkmove                    local
  71.     template    tpl_ghost=ghost                            local
  72.     template    tpl_indy=indy_sh_actor                    local
  73.  
  74.     sector        camsector                                local
  75.  
  76.     cog            hints                                            # send message when complete. 
  77.  
  78. # labels...    
  79.     flex        cameramove                                local
  80.     flex        randlocationlines                        local
  81.     flex        randwrongitemlines                        local
  82.  
  83. # vars...    
  84.     vector        v_camspot                                local
  85.     vector        v_ipyr                                    local
  86.  
  87.     flex        yaw                                        local
  88.  
  89.     int            open=1                                    local
  90.     int            talking=0                                local
  91.     int            ready=0                                    local
  92.  
  93.     int            l_newline=50                            local
  94.     int            l_oldline=50                            local
  95.     int            wi_newline=50                            local
  96.     int            wi_oldline=50                            local
  97.     int            played=0                                local
  98.     int            doplay                                    local
  99.     int            cursound                                local
  100.  
  101.     int            speak0                                    local
  102.     int            curcam                                    local
  103.     int            stopcall=0                                local
  104.  
  105. end
  106.  
  107. # ==============================================================================
  108.  
  109. code
  110.     
  111. startup:
  112.  
  113.     AttachThingToThing(pully0, boom0);
  114.     player = GetLocalPlayerThing();
  115.     ClearThingFlags(crate0, 0x4000000);        # non-climbable crate
  116.  
  117.     return;
  118.  
  119. # ..............................................................................
  120.  
  121. activated:
  122.  
  123.     if ((getsenderref() == crank0) || (getsenderref() == rstycrnk))
  124.     {
  125.         if (stopcall != 0) return;
  126.         stopcall = 1;
  127.         if (isMoving(boom0)) return;
  128.  
  129.         if (GetCurItem(player) == 73)
  130.         {
  131.         
  132.             curcam = GetCurrentCamera();
  133.             MakeMeStop();
  134.             DeselectWeaponWait(player);
  135.             StartCutscene(1);
  136.             CopyPlayerHolsters(player, indyactor);
  137.             SetThingFlags(player, 0x80000);
  138.             ClearThingFlags(indyactor, 0x80000);
  139.             AISetCutsceneMode(indyactor);
  140.             SetCollideType(indyactor, 0);
  141.  
  142.             # Make cam...
  143.             v_camspot = VectorAdd(VectorTransformToOrient(indyactor, '-0.15 0.2 0.15'), GetThingPos(indyactor));    
  144.             camsector = FindNewSectorFromThing(player, v_camspot);
  145.             crankcam = CreateThingAtPos(tpl_ghost, camsector, v_camspot, '0 0 0');
  146.             CaptureThing(crankcam);
  147.  
  148.             # Cut to high angle...
  149.             SetCameraLookInterp(2, 0);
  150.             SetCameraPosInterp(2, 0);
  151.             SetCameraFocus(2, crankcam);
  152.             SetCameraSecondaryFocus(2, crank0);
  153.             SetCurrentCamera(2);
  154.             SetCameraFOV(70, 0, 0.0);
  155.  
  156.             AISetLookThing(indyactor, crank0);            
  157.             AIWaitForStop(indyactor);
  158.                 
  159.             PlayKey(indyactor, in_reach, 4, 0x12, 0);
  160.             Sleep(0.3);
  161.  
  162.             rstycrnk = CreateThing(tpl_crank, crnkghost);
  163.             CaptureThing(rstycrnk);
  164.  
  165.             PlaySoundThing(placecrnk, rstycrnk, 1.0, 10, 25, 0);
  166.             ChangeInv(player, 73, -1);
  167.  
  168.             # set to crank...
  169.             ready = 1;
  170.  
  171.             PlayVoice(indyactor, crnkplace, 1.0, 1);
  172.             TeleportThing(player, indyactor);
  173.             Sleep(0.5);
  174.  
  175.             v_camspot = VectorAdd(VectorTransformToOrient(indyactor, '-0.15 -0.3 0.1'), GetThingPos(indyactor));    
  176.             SetCameraPosition(1, v_camspot);
  177.             SetCurrentCamera(curcam);
  178.             SetThingFlags(indyactor, 0x80000);
  179.             ClearThingFlags(player, 0x80000);
  180.  
  181.             EndCutscene();
  182.             ClearActorFlags(player, 0x200000);
  183.  
  184.             stopcall = 0;
  185.             return;
  186.         }
  187.  
  188.         if (ready == 1)
  189.         {    
  190.             curcam = GetCurrentCamera();
  191.             MakeMeStop();
  192.             DeselectWeaponWait(player);
  193.             StartCutscene(1);
  194.             CopyPlayerHolsters(player, crankindy);
  195.             
  196.             v_ipyr = GetThingLVecPYR(player);
  197.             yaw = VectorY(v_ipyr);
  198.             if ((yaw > -50) || (yaw < -125))
  199.             {
  200.                 call randlocationlines;
  201.                 EndCutscene();
  202.                 ClearActorFlags(player, 0x200000);
  203.                 
  204.                 stopcall = 0;
  205.                 return;
  206.             }
  207.  
  208.             SetThingFlags(player, 0x80000);
  209.             ClearThingFlags(crankindy, 0x80000);
  210.  
  211.             SetCameraLookInterp(2, 0);
  212.             SetCameraPosInterp(2, 0);
  213.             SetCameraFocus(2, campos);
  214.             SetCameraSecondaryFocus(2, crank0);
  215.             SetCurrentCamera(2);
  216.             SetTimer(1.0);
  217.             PlayKey(crankindy, standbd, 4, 0x12, 1);
  218.             PlaySoundLocal(crankmove, 0.75, 0, 0x0, 0);
  219.             PlayKey(rstycrnk, turncrnk, 4, 0x12, 0);
  220.             PlayKey(crankindy, pull, 4, 0x12, 0);
  221.  
  222.             SetCameraLookInterp(2, 1);
  223.             SetCameraInterpSpeed(2, 2.0);
  224.             Sleep(1.5);
  225.  
  226.             # Pan to pulley...
  227.             SetCameraSecondaryFocus(2, pully0);
  228.             Sleep(2.5);
  229.             PlayKey(crankindy, turnbd, 4, 0x12, 1);
  230.             CopyOrientAndPos(crankindy, player);
  231.             SetCameraLookInterp(2, 0);
  232.             SetCameraFOV(90, 0, 0);
  233.             SetCameraInterpSpeed(2, 1.0);
  234.             
  235.             SetCameraPosition(1, GetThingPos(campos));
  236.             SetCurrentCamera(curCam);
  237.             ResetCameraFOV(0, 0.0);
  238.             SetThingFlags(crankindy, 0x80000);
  239.             ClearThingFlags(player, 0x80000);
  240.  
  241.             EndCutscene();
  242.             ClearActorFlags(player, 0x200000);
  243.  
  244.             stopcall = 0;
  245.             return;
  246.         }
  247.         else
  248.         {
  249.             if (talking == 1) return;
  250.             talking = 1;
  251.             MakeMeStop();
  252.             DeselectWeaponWait(player);
  253.             StartCutscene(0);
  254.             SetExtCamOffsetToThing(campos);
  255.             PlayKey(player, in_reach, 4, 0x12, 0);
  256.  
  257.             if (GetCurItem(player) >= 1)
  258.             {
  259.                 # player is using a wrong item
  260.                 Sleep(0.5);
  261.                 call randwrongitemlines;
  262.             }
  263.             else
  264.             {
  265.                 # player isn't using anything
  266.                 Sleep(0.5);
  267.                 speak0 = PlayVoice(player, nocrnk, 1.0, 0);
  268.             }
  269.  
  270.             WaitForSound(speak0);
  271.             RestoreExtCam();
  272.             EndCutscene();
  273.             ClearActorFlags(player, 0x200000);
  274.  
  275.             talking = 0;
  276.             stopcall = 0;
  277.             return;
  278.         }
  279.     }
  280.  
  281.     stopcall = 0;
  282.     return;
  283.  
  284. # ..............................................................................
  285.  
  286. arrived:    
  287.  
  288.     SetCollideType(boom0, 3);
  289.     Print("Boom arrived");
  290.  
  291.     return;
  292.  
  293. # ..............................................................................
  294.  
  295. timer:
  296.  
  297.     if (open==1)
  298.     {
  299.         open = 0;
  300.         SetCollideType(boom0, 0);
  301.         Rotate(boom0, -50, 1, 4);
  302.         SendMessageEx(hints, user4, 1, 0, 0, 0);        #param0=1; solved.
  303.  
  304.         return;
  305.     }
  306.  
  307.     if (open==0)
  308.     {
  309.         open = 1;
  310.         SetCollideType(boom0, 0);
  311.         Rotate(boom0, 50, 1, 4);
  312.         SendMessageEx(hints, user4, 0, 0, 0, 0);        #param0=0; Unsolved.
  313.  
  314.         return;
  315.     }
  316.  
  317.     return;
  318.  
  319. # ..............................................................................
  320.  
  321. cameramove:
  322.  
  323.     SetCameraLookInterp(2, 1);
  324.     SetCameraInterpSpeed(2, 2);
  325.     Sleep(0.1);
  326. #    SetCameraSecondaryFocus(2, lookpos);
  327.  
  328.     return;
  329.  
  330. # ..............................................................................
  331.  
  332. randlocationlines:
  333.  
  334.     Print("locationlines");
  335.     
  336.     while (l_newline == l_oldline)
  337.     {        
  338.         l_newline = RandBetween(0, 5);
  339.     }
  340.     l_oldline = l_newline;
  341.     
  342.     cursound = PlayVoice(player, in_wrongspot0[l_newline], 1, 0);
  343.  
  344.     doplay = Randbetween(0, 2);
  345.     if ((doplay == 0) || (played == 0))
  346.     {
  347.         Print("playing key...");
  348.         PlayKey(player, in_bothup, 4, 0x12, 0);
  349.         played = 1;
  350.     }
  351.     WaitForSound(cursound);
  352.  
  353.     return;
  354.  
  355. # ..............................................................................
  356.  
  357. randwrongitemlines:
  358.  
  359.     while (wi_newline == wi_oldline)
  360.     {        
  361.         wi_newline = RandBetween(0, 19);
  362.         if (wi_newline < 15)
  363.         {    
  364.             wi_newline = RandBetween(0, 3); # ~1/5 chance for lines 0 thru 3
  365.         }
  366.         if (wi_newline == 19)
  367.         {
  368.             wi_newline = 6; # 1/20 chance for line 6 
  369.         }
  370.         if (wi_newline > 16)
  371.         {
  372.             wi_newline = 5; # 1/10 chance for line 5 
  373.         }
  374.         if (wi_newline > 14)
  375.         {
  376.             wi_newline = 4; # 1/10 chance for line 4
  377.         }
  378.     }
  379.     wi_oldline = wi_newline;    
  380.     speak0 = PlayVoice(player, in_itemline0[wi_newline], 1, 1);
  381.     return;
  382.  
  383. end
  384.  
  385.